package com.cbl.v.ssczs.view.activity;

import android.widget.GridView;

import com.cbl.v.ssczs.R;
import com.cbl.v.ssczs.mode.entity.LocalDataBean;
import com.cbl.v.ssczs.view.adapter.GridAdapter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import butterknife.BindView;


public class LocalActivity extends BaseActivity {
    @BindView(R.id.gv_item)
    GridView gvItem;
    private List<LocalDataBean> beanList;
    private GridAdapter adapter;
    private List<String> titleList;
    private List<String> urlAddressList;

    @Override
    protected int getLayout() {
        return R.layout.activity_local;
    }

    @Override
    public void initView() {
        setTitle("快三开奖信息列表");
        beanList = new ArrayList<>();
        titleList = new ArrayList<>();
        urlAddressList = new ArrayList<>();
        adapter = new GridAdapter(getContext(), beanList);
        gvItem.setAdapter(adapter);
    }

    @Override
    public void initData() {
        getData();
    }

    @Override
    public void initListener() {

    }

    private void getData() {
        Collections.addAll(titleList,
                "安徽快三",
                "北京快三",
                "福建快三",
                "甘肃快三",
                "广西快三",
                "贵州快三",
                "河北快三",
                "湖北快三",
                "吉林快三",
                "江苏快三",
                "江西快三",
                "内蒙古快三",
                "上海快三");
        Collections.addAll(urlAddressList,
                "http://t.apiplus.net/newly.do?code=cqssc&rows=20&format=json",
                "http://f.apiplus.net/bjk3-20.json",
                "http://f.apiplus.net/fjk3-20.json",
                "http://f.apiplus.net/gsk3-20.json",
                "http://f.apiplus.net/gxk3-20.json",
                "http://f.apiplus.net/gzk3-20.json",
                "http://f.apiplus.net/hebk3-20.json",
                "http://f.apiplus.net/hubk3-20.json",
                "http://f.apiplus.net/jlk3-20.json",
                "http://f.apiplus.net/jsk3-20.json",
                "http://f.apiplus.net/jxk3-20.json",
                "http://f.apiplus.net/nmgk3-20.json",
                "http://f.apiplus.net/shk3-20.json"
        );
        for (int i = 0; i < titleList.size(); i++) {
            LocalDataBean bean = new LocalDataBean();
            bean.setTitle(titleList.get(i));
            bean.setUrlAddress(urlAddressList.get(i));
            beanList.add(bean);
        }
        adapter.notifyDataSetChanged();
    }


}
